import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author songxz
 * @date 2022/11/15
 */
public class ReenTrantDemo {
    public static void main(String[] args) {
        System.out.println("start -------");
        ReenTrantDemo.test1();
        System.out.println("end -------");
    }

    public static synchronized void test1() {
        System.out.println("test 1");
        test2();
    }

    public static synchronized void test2() {
        System.out.println("test 2 ");
//        test2();
        new AtomicInteger().compareAndSet(1,2);
    }
}
